Ccay.Module.define("Ccay.example.ui.igird.copyPaste", function (page, $S) {
	page.ready = function(){
		var linkBtns = [
			{text: "${id}", click: page.operateTest}
		];
		var gridOption = {
			minHeight: 400,
			maxHeight: 400,
			editMode: true,
			wrapHead: false,
			remoteSort: true,
			showStatus: true,
			customSetting: true,
			moveByKeyword: true,
			allowCopy: true,
			//dragObj: "row",
			toolPanel: "#tbriStudent",
			fullPanel: "#fsiStudent",
			fullOutTip: true,
		    columns: [
		    	{columnType: 'select',multi: true},
		    	{columnType: 'operate', width: 70, freezeable: true, btns:linkBtns},
		 		{field: 'name', width:90, header: "ccay.common.label.name", freezeable: true, rule: {required: true}},
		 		{field: 'sex', width:70, header: "sSex", type: 'bool', format: {isIcon: true}},
		 		{field: 'age', width:70, header: "sAge", type: 'integer', sort: "asc", hiddenable: false, rule: {range: [0, 80]}},
		 		{field: 'birthday', width:110, header: "sBirthday", type: 'date'},
		 		{field: 'province', width:100, header: "lookup", type: 'lookup', format: 
		 		{supportLang: true, code: "province"}, rule: {required: true}}, 
		 		{field: 'tuition', width: 100, header: "Tuition", type: 'rate', format: {total: 100, fraction: 2,htmlView: true, section: [20, 40, 80]}},
		 		{field: 'blog', width:200, header: "sBlog", showTip:true},
		 		{field: 'tuition', width:100, header: "sTuition", type: 'currency', format:{fraction:2, flag:'￥[currency]'}},
		 		{field: 'lastUpdateDate', width:130, header: "ccay.common.label.lastUpdatedDate", type: 'datetime', editable: false}
		    ],
			ajax:{
			   	url: 'services/ccay/demo/student/list/page/${pageSize}/${curPage}/${orderBy}'
			},
		    operation: {
		    	search: {
		    		btn: '#btniStudentSearch',
					panel: '#fmiStudent'
		    	},
		    	del: {
		    		btn: '#btniStudentDel',
		    		undoBtn: '#btniStudentUndoDel'
		    	},
		    	insert: {
		    		btn: '#btniStudentAdd',
		    		copy: true,
		    		clear: ['id', 'name', 'lastUpdateDate'],
		    		defaultRow: {sex: 1, blog: 'http://'}
		    	},
		    	save: {
		    		btn: '#btniStudentSave',
		    		ajax: {
		    			url: "services/ccay/demo/student/batch"
		    		}
		    	}
		    }
		};
		
		$S("#grdiStudent").igrid(gridOption);
		
	};
	
	page.operateTest = function (value) {
		alert(Ccay.DataHelper.toJsonStr(value));
	};
	
	page.openDemo = function(tabId){
		$S("copyPasteDemo").getCcayTabManager().selectItem(tabId);
		$S("li[tabid='" + tabId + "']").click();
	};
});